import Vue from "vue"
import { addServiceUrl } from '@/utils'

// 购物服务 /shopping-service
const urlDict = addServiceUrl('', {
  // 获取轮播图
  getSlideAdvers: "/slideshow/list",
  // 获取分类列表
  getClassifyTab: "/pms/product/category/getCategoryList",
  // 获取最新资讯
  getInformation: "/consult/consultList",
  // 资讯相关接口
  getInfoDetails: "/consult/advisoryDetails",
  // 获取商品列表
  getShopList: "/pms/product/getProductList",
  // 搜索页面
  getSearch: "/pms/product/searchName",
  // 获取今日推荐
  getRecommend: "/pms/product/getRecommendList",

  // 查询一级分类或者二级分类
  getCatory: "/pms/product/category/getCategoryList/",

  // 商品详情
  getGoodsDetail: '/commodity/getCommodityDetails',

  // // 获取鲜花详情列表
  // getAllShopList: '/api/ums/market/getFlowerMarketList',

  // 获取司机列表
  getDriveList: '/driver/relation',
  // 获取竞价列表
  getQuotationList: `/competitiveTender/getQuotationList`,

  // 在线拍卖
  getLineAuctionList: '/api/online/getUserOnlineList',

  // 获取在线竞标管理
  getOnlineBidding: "/pms/product/getAuctionProductList",

  // 获取供应商和基地列表
  getSupplier: "/pms/business/getBusinessList",
  // 广告列表
  getAvMsg: "/slideshow/list",

  // 商家信息
  getShopInfo: "api/ums/businessInfo/getBusinessInfo",
  // 详情统计图
  goodsDetailEchart: "/ums/market/getDetailFlowerMarketList",
  // 添加商品到购物车
  addCart: "/api/oms/cartItem/add",
   
});

export default {

  // 商品详情
  getGoodsDetail: (data) => {
    return Vue.axios.post(`${urlDict.getGoodsDetail}`, data)
  },
  getCatory: (id) => {
    return Vue.axios.post(`${urlDict.getCatory}/${id}`)
  },

  // 获取轮播图
  getSlideAdvers: (type) => {
    return Vue.axios.post(urlDict.getSlideAdvers, { type })
  },
  // 获取tab分类列表
  getClassifyTab: (pid) => {
    return Vue.axios.post(`${urlDict.getClassifyTab}/${pid}`)
  },
  // 获取资讯
  getInformation: () => {
    return Vue.axios.post(urlDict.getInformation)
  },
  // 资讯相关
  getInfoDetails: (id) => {
    return Vue.axios.post(`${urlDict.getInfoDetails}/${id}`)
  },
  // 获取商品团购列表
  getShopList: ( page, pageSize, productType, rankType, sort) => {
    return Vue.axios.post(urlDict.getShopList, {
      page,
      pageSize,
      productType,
      rankType,
      sort,
    })
  },
  // 获取商品特价列表
  getspecialList: ( page, pageSize, productType, rankType, sort) => {
    return Vue.axios.post(urlDict.getShopList, {
      page,
      pageSize,
      productType,
      rankType,
      sort,
    })
  },
  // 一级分类特价列表
  getaclassspecial:(firstClassId,page,pageSize,productType,rankType,sort) => {
    return Vue.axios.post(urlDict.getShopList,{
      firstClassId,
      page,
      pageSize,
      productType,
      rankType,
      sort
    })
  },
  // 一级分类团购列表
  getgrouppecial:(firstClassId,page,pageSize,productType,rankType,sort) => {
    return Vue.axios.post(urlDict.getShopList,{
      firstClassId,
      page,
      pageSize,
      productType,
      rankType,
      sort
    })
  },
  // 获取商品拍卖列表
  getauctionList: ( page, pageSize, productType, rankType, sort) => {
    return Vue.axios.post(urlDict.getShopList, {
      page,
      pageSize,
      productType,
      rankType,
      sort,
    })
  },
  // 搜索页面
  getSearch: (data) => {
    return Vue.axios.post(urlDict.getSearch, data)
  },
  // // 获取鲜花行情商品列表
  // getAllShopList:(data) => {
  //   return Vue.axios.post(urlDict.getAllShopList, data)
  // },
  // 获取今日推荐
  getRecommend: ( page, pageSize) => {
    return Vue.axios.post(urlDict.getRecommend, {
      page,
      pageSize,
    })
  },
  // 获取一级分类今日推荐
  getaclasssRecommend: (firstClassId, page, pageSize) => {
    return Vue.axios.post(urlDict.getRecommend, {
      firstClassId,
      page,
      pageSize,
    })
  },
  // // 获取司机列表
  // getDriveList: (data) => {
  //   return Vue.axios.post(urlDict.getiDriveList,{

  //   })
  // }

  // 在线竞标管理列表
  getOnlineBidding: (page) => {
    return Vue.axios.post(urlDict.getOnlineBidding,{
      page
    })
  },
  // 获取供应商列表
  getSupplier:(businessApplyType,page,pageSize) => {
    return Vue.axios.post(urlDict.getSupplier,{
      businessApplyType,
      page,
      pageSize
    })
  },
  getRecommend: (data) => {
    return Vue.axios.post(urlDict.getRecommend, data)
  },

  getQuotationList: (data) => {
    return Vue.axios.post(`${urlDict.getQuotationList}/${data.id}`, data)
  },

  // 轮播位置1->首页轮播；2-一级分类；3-二级分类；4-委托采购；5-团购；6-在线拍卖；7-特价促销
  getAvMsg: (data) => {
    return Vue.axios.post(`${urlDict.getAvMsg}/${data.id}`, data)
  },
  getShopInfo: () => {
    return Vue.axios.post(`${urlDict.getShopInfo}`)
  },
  goodsDetailEchart: () => {
    return Vue.axios.post(`${urlDict.goodsDetailEchart}`)
  },
  // 添加商品到购物车
  addCart: (data) => {
    return Vue.axios.post(`${urlDict.addCart}`, data)
  },
}
